{extend name="shop/b2c/Member/base" /}
{block name="resources"}
<!-- 添加css、字体文件文件 -->

{/block}
{block name="main"}
  
   <div class="user-right">
    	<div class="box">
          <script type="text/javascript" src="js/region.js"></script><script type="text/javascript" src="js/shopping_flow.js"></script> 
         
          <div class="tabmenu">
            <ul class="tab pngFix">
              <li class="first active">地址列表</li>
            </ul>
          </div>
          <div class="alert alert-success">
            <h4>操作提示：</h4>
            <ul>
              <li>您可对已有的地址进行编辑及删除，亦可新增收货地址</li>
            </ul>
          </div>
			<input type="hidden" id="adressid" value="{$address_info['id']}" />
			<input type="hidden" id="hidUrl" value="" />
			<input type="hidden" id="provinceid" value="{$address_info['province']}" />
			<input type="hidden" id="cityid" value="{$address_info['city']}" />
			<input type="hidden" id="districtid" value="{$address_info['district']}" />
			<input type="hidden" value="-1" id="AddressID">    
          <div class="mar_top">
                  
            <table width="100%" border="0" cellpadding="10" cellspacing="1" bgcolor="#eeeeee">
                <tr>
                  <td align="right" width="10%">配送区域：</td>
                  <td colspan="3" align="left"><!-- <select name="country" id="selCountries_0" onchange="region.changed(this, 1, 'selProvinces_0')">
                 
                         <option value="0">请选择国家</option>
                         <option value="1" selected>中国</option>
                      </select> -->
                    <select name="province" id="seleAreaNext" onchange="GetProvince();getSelCity()">
                       <option value="">请选择省</option>
                     </select>
                    <select name="city" id="seleAreaThird" onchange="getSelCity()">
                      <option value="">请选择市</option>
                                          </select>
                    <select name="district" id="seleAreaFouth">
                      <option value="-1">请选择区</option>
                    </select>
                    (必填) </td>
                </tr>
                <tr>
                  <td align="right" width="10%">收货人姓名：</td>
                  <td align="left" width="40%"><input name="consignee" type="text" class="inputBg" id="Name" value="{$address_info['consigner']}" />
                    (必填) </td>
                </tr>
                <tr>
                  <td align="right">详细地址：</td>
                  <td align="left" colspan="3"><input name="address" type="text" class="inputBg" id="AddressInfo" value="{$address_info['address']}" style="width: 692px;"/>
                    (必填)</td>
               	</tr>
               <tr>
                  <td align="right">手机：</td>
                  <td align="left"><input name="mobile" type="text" class="inputBg" id="Moblie" value="{$address_info['mobile']}" />
                </td>
                </tr> 
              
                <tr>
                <td colspan="4" align="center">
                   <button onclick="saveAddress()" class="main-btn main-btn-large">确认修改</button>
                </tr>
              </table>

            <div class="blank10"></div>
                
             
          </div>
     
        </div>
    </div>
</div>


{/block}
{block name="javascript"}
<script src="__TEMP__/{$style}/public/js/address.js"></script>
<script type="text/javascript">

$(function(){
	var province=$("#provinceid").val();
	var city=$("#cityid").val();
	var district=$("#districtid").val();
	var selProvince=$("#seleAreaNext")[0];
	for (var i = selProvince.length - 1; i >= 0; i--) {
		selProvince.options[i] = null;
	}
	var opt = new Option("请选择省", "-1");
	selProvince.options.add(opt);
		//添加省
		$.ajax({
			type : "post",
			url : "SHOP_MAIN/Member/getProvince",
			dataType : "json",
			success : function(data) {
				if (data != null && data.length > 0) {
					for (var i = 0; i < data.length; i++) {
						var opt = new Option(data[i].province_name, data[i].province_id);
						selProvince.options.add(opt);
					}
					$("#seleAreaNext").val(province);
				}
			}
		});
	 var address_id=$("#adressid").val();
	 if(address_id!=0){
		 //查询这个收货地址的详细地址
		//加载市
 				var selCity = $("#seleAreaThird")[0];
 				for (var i = selCity.length - 1; i >= 0; i--) {
 					selCity.options[i] = null;
 				}
 				var opt = new Option("请选择市", "-1");
 				selCity.options.add(opt);
 				$.ajax({
 					type: "post",
 					url: "SHOP_MAIN/Member/GetCity",
 					dataType: "json",
 					data: { "province_id": province },
 					success: function (data) {
 						if (data != null && data.length > 0) {
 							for (var i = 0; i < data.length; i++) {
 								var opt = new Option(data[i].city_name, data[i].city_id);
 								selCity.options.add(opt);
 							}
 						   $("#seleAreaThird").val(city);
 						}
 					}
 				});
 				//加载区县
 			   var selArea = $("#seleAreaFouth")[0];
 				for (var i = selArea.length - 1; i >= 0; i--) {
 					selArea.options[i] = null;
 				}
 				var opt = new Option("请选择区/县", "-1");
 				selArea.options.add(opt);
 				$.ajax({
 					type: "post",
 					url: "SHOP_MAIN/Member/getDistrict",
 					dataType: "json",
 					data: { "city_id": city },
 					success: function (data) {
 						if (data != null && data.length > 0) {
 							for (var i = 0; i < data.length; i++) {
 								var opt = new Option(data[i].district_name, data[i].district_id);
 								selArea.options.add(opt);
 							}
 						   $("#seleAreaFouth").val(district);
 						}
 					}
 				});
	 }
	});
	
</script>
{/block}